package com.cn.dream_order_server.service.impl;

import com.cn.dream_order_server.mapper.OrderOrderMapper;
import com.cn.dream_order_server.mapper.OrderOrdertypeManageMapper;
import com.cn.dream_order_server.pojo.OrderOrderExample;
import com.cn.dream_order_server.pojo.OrderOrdertypeManage;
import com.cn.dream_order_server.pojo.OrderOrdertypeManageExample;
import com.cn.dream_order_server.service.OrderOrdertypeManageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service
public class OrderOrdertypeManageServiceImpl implements OrderOrdertypeManageService {


    @Autowired
    private OrderOrdertypeManageMapper orderOrdertypeManageMapper;

    @Autowired
    private OrderOrderMapper orderOrderMapper;

    @Override
    public List<OrderOrdertypeManage> getOrderOrdertypeManageAllList() {
        OrderOrdertypeManageExample example = new OrderOrdertypeManageExample();
        OrderOrdertypeManageExample.Criteria criteria = example.createCriteria();
        //添加查询条件
        ArrayList<Integer> list1 = new ArrayList<Integer>();
        list1.add(5);
        list1.add(6);
        criteria.andOrderOrdertypeManageIdNotIn(list1);
        List<OrderOrdertypeManage> list = orderOrdertypeManageMapper.selectByExample(example);
        for (OrderOrdertypeManage orderOrdertypeManage:list ) {
            //创建条件
            OrderOrderExample example1 = new OrderOrderExample();
            OrderOrderExample.Criteria criteria1 = example1.createCriteria();
            criteria1.andOrderOther4EqualTo(orderOrdertypeManage.getOrderOrdertypeManageId());
            long l = orderOrderMapper.countByExample(example1);
            orderOrdertypeManage.setNum(l);
        }
        return list;
    }
}
